/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package projecteuler;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author ChunchO
 */
public class Problem021 {

	public static void main(String[] args){
		int sumaFinal = 0;
		for(int i = 1;i<=10000;i++)
		{
			if(i == 220)
				System.out.println("zomg");
			int suma = 1;
			for(int j = 2;j<=Math.sqrt(i);j++)
			{
				if (i % j == 0)
				{
					suma+= j + (i/j);
				}
			}
			int suma2 = 1;
			for(int j = 2;j<=Math.sqrt(suma);j++)
			{
				if (suma % j == 0)
				{
					suma2+= j + (suma/j);
				}
			}
			if(suma2 == i && (i!=suma))
				sumaFinal+= i+suma;
		}
		System.out.println(sumaFinal/2);
	}


}
